﻿Imports Lourdes.BackEnd.BC
Imports Lourdes.BackEnd.Interfaces
Imports Lourdes.BackEnd.View
Imports Lourdes.BackEnd.Modelo
Imports Lourdes.BackEnd
Namespace View
  Public Class vRemito
    Private _intIdRemito As Integer

    Private _Productos As vLstProductos
    Public Property Productos() As vLstProductos
      Get
        Return _Productos
      End Get
      Set(ByVal value As vLstProductos)
        _Productos = value
      End Set
    End Property

    Private _Cabecera As DocRemito
    Public Property Cabecera() As DocRemito
      Get
        Return _Cabecera
      End Get
      Set(ByVal value As DocRemito)
        _Cabecera = value
      End Set
    End Property

    Public Function Insert() As Integer
      Dim bcRemito As BC_DocRemito
      Dim bcRemitoDet As BC_DocRemitoDet
      Try
        bcRemito = New BC_DocRemito
        bcRemitoDet = New BC_DocRemitoDet
        _intIdRemito = bcRemito.RemitoCabeceraAddOne(_Cabecera)
        bcRemitoDet.RemitoDetalleAddFromView(_Productos, _intIdRemito)
        Return _intIdRemito
      Catch ex As Exception
        Throw ex
      End Try
    End Function

    Public Sub New()
      _Productos = New vLstProductos
      _Cabecera = New DocRemito
    End Sub
  End Class
End Namespace
